package com.qiantu.phone.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.hjq.base.BaseAdapter;
import com.qiantu.api.entity.ControllerBean;
import com.qiantu.api.entity.KGXAddData;
import com.qiantu.phone.R;
import com.qiantu.phone.app.AppAdapter;
import com.qiantu.phone.glide.GlideApp;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class KGXAddAdapter extends AppAdapter<KGXAddData> {
    public KGXAddAdapter(@NonNull Context context){
        super(context);
    }
    @NonNull
    @Override
    public KGXAddAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new KGXAddAdapter.ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private TextView tvName;
        private TextView tvNum;

        private ViewHolder() {
            super(R.layout.item_kgx_add);
            tvName = findViewById(R.id.tv_name);
            tvNum = findViewById(R.id.tv_num);
//            itemView.setOnClickListener(mOnClickListener);
        }

        @Override
        public void onBindView(int position) {
            KGXAddData item = getItem(position);
            tvName.setText(item.getName());
            String num = item.getNum() + "个";
            tvNum.setText(num);
        }
    }

    @Override
    public long getItemId(int position) {
        return getData().get(position).hashCode();
    }

//    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
//        @Override
//        public void onClick(View v) {
//
//        }
//    };
}
